package com.example.wechattakeaway.controller;

import com.example.wechattakeaway.service.OrderSupplyService;
import com.example.wechattakeaway.vo.ResultVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@Api(value = "订单补充管理",tags = {"订单补充操作接口"})
@RestController
@RequestMapping("/OrderSupplyController")
public class OrderSupplyController {

    @Autowired
    OrderSupplyService orderSupplyService;

    @ApiOperation("新增一个订单补充")
    @PostMapping("/InsertSupply")
    public ResultVO InsertSupply(Integer orderDetailId, String content){
        return orderSupplyService.InsertSupply(orderDetailId, content);
    }

    @ApiOperation("根据id精确查询订单补充")
    @PostMapping("/SelectSupplyById")
    public ResultVO SelectSupplyById(Integer supplyId){
        return orderSupplyService.SelectSupplyById(supplyId);
    }

    @ApiOperation("根据订单详情id查询所有补充内容")
    @PostMapping("/SelectAllByOrder")
    public ResultVO SelectAllByOrder(Integer pageNum,Integer orderDetailId){
        return orderSupplyService.SelectAllByOrder(pageNum,orderDetailId);
    }

}
